<template>
	<!-- 通告 -->
	<view class="announcement" @click="goNotice">
		<!-- 一条 -->
		<view class="notice" v-if='list.length==1' >
			<view class="left">
				<image :style="{width:srcobj.width+'px',height:srcobj.height+'px'}" class="noticeimg" :src="srcobj.srcurl" mode=""></image>
			</view>
			<view class="noticebox">
				<text class="tag">
					热点
				</text>
				<uni-notice-bar class="uniNoticeBar" background-color="transparent" color="#333333" scrollable :text="list[0].title"></uni-notice-bar>
			</view>
		</view>
		<!-- 多条 -->
		<view class="noticeBar" v-else >
			<view class="left">
				<image  :style="{width:srcobj.width+'px',height:srcobj.height+'px'}" class="noticeimg" :src="srcobj.srcurl" mode=""></image>
			</view>
			<view class="noticebox">
				<text class="tag">
					热点
				</text>
				<swiper class="uniNoticeBar list" circular="true" vertical="true" autoplay="true" interval="3000" duration="1000">
					<swiper-item v-for="item in list" :key="item.id">
						<view class="textsl1">
							{{ item.title }}
						</view>
					</swiper-item>
				</swiper>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		// 翻滚
		name: "killGoodsList",
		props: {
			type: {
				type: Number,
				default: 0,//0：一排一个，1：一排两个
			},
			list: {
				type: Array,
				default: []
			},
			Dataobj:{
				type:Object,
				default: {}
			}
		},
		data() {
			return {
			srcobj:{
					srcurl:'',
					width:'',
					height:'',
			}
			};
		},
		watch: {
		    current: {
		        handler (newName, oldName) {
						uni.setStorageSync('prevIndex',this.currents)
		        },
		        immediate: true
		    }
		},
		mounted(){
				this.getSrc()
		},
		methods: {
			goNotice(){
				this.$store.state.data=this.list
				uni.navigateTo({
					url:"/pages/index/notice"
				})
			},
				getSrc(){
						if(this.Dataobj.tabType == 1){
							this.srcobj.srcurl = 'https://pili-vod.guanxikeji.com/moban/img/1719221182040.png'
							this.srcobj.width='48'
							this.srcobj.height='38'
						}else if(this.Dataobj.tabType == 2){
							this.srcobj.width='71'
							this.srcobj.height='22'	
							this.srcobj.srcurl = 'https://pili-vod.guanxikeji.com/moban/img/1719221217216.png'
						}else if(this.Dataobj.tabType == 3){
							this.srcobj.srcurl = 'https://pili-vod.guanxikeji.com/moban/img/1719221209952.png'
							this.srcobj.width='37'
							this.srcobj.height='33'
						}else if(this.Dataobj.tabType == 4){
							this.srcobj.srcurl = 'https://pili-vod.guanxikeji.com/moban/img/1719221203727.png'
							this.srcobj.width='60'
							this.srcobj.height='29'
						}else if(this.Dataobj.tabType == 5){
							this.srcobj.srcurl = 'https://pili-vod.guanxikeji.com/moban/img/1719221197807.png'
							this.srcobj.width='36'
							this.srcobj.height='44'
						}else if(this.Dataobj.tabType == 6){
							this.srcobj.srcurl = 'https://pili-vod.guanxikeji.com/moban/img/1719221190839.png'
							this.srcobj.width='35'
							this.srcobj.height='25'
						}
				}
		}
	}
</script>

<style lang="scss" scoped>
		// 公告
		.announcement{
			padding: 10upx	;
			margin:20upx;
			background-color: #fff;
			border-radius: 20upx;
			color: #000;
			font-size: 14px;
    box-shadow: 0px 0px 10px 1px rgba(0, 0, 0, 0.08);
			.left{
				border-right: 1px solid #E6EAED;
				padding-right: 10px;
				.noticeimg{
					width: 84px;
					height: 27px;
				}
			}
			.noticebox {
				width: calc(100% - 100px);
				margin: 0;
				margin-left: 10px;
				display: flex;
				align-items: center;
				justify-content: space-between;
				text{
					color: #FF620C;
					border: #FF620C 1px solid;
					background-color: #fff;
					border-radius: 5px;
					font-size: 12px;
					padding: 0 5px;
				}
				.uniNoticeBar{
					width: calc(100% - 40px);
				}
			}
			.notice {
				display: flex;
				margin: 0 $padding;
				align-items: center;
			}
			.noticeBar {
				padding: 20upx 0;
				margin: 0 $padding;
			  width: 690rpx;
			  height: 50rpx;
			  line-height: 50rpx;
			  font-size: 24rpx;
			  border-radius: 50rpx;
			  display: flex;
				.left{
					// width: 94px;
					// height: 27px;
					border-right: 1px solid #E6EAED;
					padding-right: 10px;
					.noticeimg{
						width: 84px;
						height: 27px;
					}
				}
				.list{
					height:  100%;
				}
			}
		}
</style>